from django.db import models


# Create your models here.
class User(models.Model):
    username = models.CharField(max_length=32, primary_key=True)
    password = models.CharField(max_length=32)
    nickname = models.CharField(max_length=50,default='')
    address = models.CharField(max_length=100,default='')
    role = models.IntegerField(default=0)
    token = models.CharField(max_length=100, default='')



class Feed(models.Model):
    feed_no = models.IntegerField(max_length=20,primary_key=True)
    feed_name = models.CharField(max_length=50)
    feed_type = models.IntegerField(max_length=8)
    price = models.IntegerField(max_length=20)
    create_time = models.IntegerField(max_length=20)


class Order(models.Model):
    order_no = models.IntegerField(max_length=20, primary_key=True)
    create_time = models.IntegerField(max_length=20)
    price = models.IntegerField(max_length=20)
    food_type = models.IntegerField(max_length=10)
    feed_no = models.IntegerField()
    user_address = models.CharField(max_length=50)


class SpecificOrder(models.Model):
    order_no = models.IntegerField(max_length=20, primary_key=True)
    order_type = models.IntegerField(max_length=8)
    create_time = models.IntegerField(max_length=20)
    price = models.IntegerField(max_length=8)
    detail = models.CharField(max_length=100)
    feedNo = models.IntegerField(max_length=8)
    user_address = models.CharField(max_length=50)


class Contract(models.Model):
    address = models.CharField(max_length=50,default="")
    name = models.CharField(max_length=30,default="", primary_key=True)
    abi = models.TextField(default="")


